import 'package:file_preview/file_preview.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:zootix/screens/chat/zt_file_preview.controller.dart';
import 'package:zootix/util/zt_screen_adaper_util.dart';

class ZtFilePreview extends StatelessWidget {
  final _controller = Get.find<ZtFilePreviewController>();
  ZtFilePreview({super.key});

  @override
  Widget build(BuildContext context) {
    return FilePreviewWidget(
      controller: _controller.previewController,
      width: ZtScreenAdaper.screenWidth(),
      height: ZtScreenAdaper.screenHeight(),
      //path 文件地址 https/http开头、文件格式结尾的地址，或者本地绝对路径
      path: _controller.url,
      callBack: FilePreviewCallBack(
          onShow: () {}, onDownload: (progress) {}, onFail: (code, msg) {}),
    );
  }
}
